package com.ufo.store.management.ui.activity;


import com.ufo.store.management.R;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.FragmentActivity;

public class StartActivity extends FragmentActivity {
	private final int NOTIFICATION_MAIN = 100;

	private Handler mMainHandler = new Handler(){
    	@Override
    	public void handleMessage(Message paramMessage)
    	{
			switch (paramMessage.what) {
				case NOTIFICATION_MAIN:
					startMainActivity();
					break;
				default:
					break;
			}
		}
    };

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
        initData();
        initView();
		new Handler().postDelayed(new Runnable() {
			@Override
			public void run() {
				startMainActivity();
			}
		}, 100);
	}

	@Override
	public void onResume() {
		super.onResume();

	}

	@Override
	public void onDestroy() {
		super.onDestroy();
	}

	@Override
	public void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
	}

	private void initData() {
    }
    
    private void initView() {
    	setContentView(R.layout.activity_start);
    }

	private void startMainActivity(){
		if (StartActivity.this.isFinishing()) {
			return;
		}
		Intent intent = new Intent(StartActivity.this, MainActivity.class);
		startActivity(intent);
		StartActivity.this.finish();
	}
}
